Skip to content

build: use placeholder version for stamping#22467

Merged
dgp1130 merged 2 commits intoangular:masterfrom
aspect-build:version-stamp
Jan 12, 2022
Merged

build: use placeholder version for stamping#22467
dgp1130 merged 2 commits intoangular:masterfrom
aspect-build:version-stamp

Conversation

@kormide
Copy link
Copy Markdown
Contributor

@kormide kormide commented Jan 10, 2022

@josephperrott @devversion @gregmagolan

The first commit switches the unstamped versions to use the more canonical 0.0.0-PLACEHOLDER and also affects the non-bazel build as it touches package.jsons and the legacy build script.

The second commit tries to take the approach in the angular components repo for substituting versions and moves the engine substitution versions there.

@gregmagolan
Copy link
Copy Markdown
Contributor

This is nice in that it makes it clear what is being substituted where and also brings this repo in like with the substitution strings used in angular/angular.

A few questions @kormide,

  1. Did you test the output of the legacy build system to verify it is still doing the right thing?

  2. Did you run the code path with the change validate-licenses?

Comment thread substitutions.bzl Outdated
# Version of the local package being built, generated via the `--workspace_status_command` flag.
"0.0.0-PLACEHOLDER": "{BUILD_SCM_VERSION}",
# Versions to declare in release `package.json`s engines field
"0.0.0-ENGINES-NODE": "^12.20.0 || ^14.15.0 || >=16.10.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was hoisting the versions to here so that they are more visible as opposed to being hidden in the filter file?

Copy link
Copy Markdown
Contributor

@gregmagolan gregmagolan Jan 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect its better to not add a new top-level file named substitutions.bzl as the substitutions are implementation details of pkg_npm; perhaps a top-level constants.bzl which defines all the constants and then use those constants in tools/defaults.bzl. Something like

RELEASE_ENGINES_NODE = "^12.20.0 || ^14.15.0 || >=16.10.0"
RELEASE_ENGINES_NPM = "^6.11.0 || ^7.5.6 || >=8.0.0"
RELEASE_ENGINES_YARN = ">= 1.13.0"

A follow-up could define some constants for WORKSPACE as well since there are node versions & hard-coded there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this in response to this feedback on the previous PR: #22425 (comment). The angular components repo has a top-level bazel file with some version substitutions.

I could make it a file with just constants. Wdyt @devversion?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. You borrowed the pattern from components. That makes sense. I looked in angular/angular and didn't see any top level .bzl files. Their subs are defined in tools/defaults.bzl https://github.com/angular/angular/blob/master/tools/defaults.bzl#L254

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like constants.bzl as its clear what the file is meant for but that is just bike shedding at that point

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to constants.bzl and moved substitution logic into tools/defaults.bzl.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! yeah I personally like the top-level file as this is something that folks can change without needing a deep understanding of the Bazel setup. Constants sounds good to me 👍

@kormide
Copy link
Copy Markdown
Contributor Author

kormide commented Jan 11, 2022

This is nice in that it makes it clear what is being substituted where and also brings this repo in like with the substitution strings used in angular/angular.

A few questions @kormide,

  1. Did you test the output of the legacy build system to verify it is still doing the right thing?

Yep.

  1. Did you run the code path with the change validate-licenses?

Yeah, I changed that in response to a ci failure.

Comment thread packages/angular_devkit/schematics_cli/blank/project-files/package.json Outdated
Comment thread scripts/build.ts
Copy link
Copy Markdown
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, aside from Joey's comment on the template file

@kormide kormide requested a review from josephperrott January 11, 2022 19:13
Copy link
Copy Markdown
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@devversion devversion added target: patch This PR is targeted for the next patch release action: merge The PR is ready for merge by the caretaker labels Jan 11, 2022
@dgp1130
Copy link
Copy Markdown
Collaborator

dgp1130 commented Jan 12, 2022

Seems like this failed to merge into 13.1.x due to a conflict. I'll merge into master for now, we'll need a separate PR for 13.1.x if we want to land it there (alternatively we just wait two weeks for 13.2.x to be cut, up to you).

@dgp1130 dgp1130 added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Jan 12, 2022
@dgp1130 dgp1130 merged commit 4102a3f into angular:master Jan 12, 2022
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants